Completed
Push — master ( 7682df...b1b8c7 )
by Timo
23:42 queued 14:36
created

SearchStatistics.js ➔ require   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 62

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 62
rs 9.4743
c 1
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
2
require([
3
  'jquery',
4
  '../typo3conf/ext/solr/Resources/Public/JavaScript/Chart.js'
5
], function ($, Chart) {
6
7
  var ctx = $('#queriesOverTime');
8
  var queryChart = new Chart(ctx, {
0 ignored issues
show
Unused Code introduced by
The variable queryChart seems to be never used. Consider removing it.
Loading history...
9
    type: 'line',
10
    data: {
11
      labels: queryLabels,
0 ignored issues
show
Bug introduced by
The variable queryLabels seems to be never declared. If this is a global, consider adding a /** global: queryLabels */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
12
      datasets: [
13
        {
14
          data: queryData,
0 ignored issues
show
Bug introduced by
The variable queryData seems to be never declared. If this is a global, consider adding a /** global: queryData */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
15
          label: "# of Queries",
16
17
          lineTension: 0.1,
18
          fill: false,
19
          backgroundColor: 'rgba(206, 43, 23, 0.4)',
20
21
          borderColor: 'rgba(206, 43, 23, 1)',
22
          borderCapStyle: 'round',
23
          borderJoinStyle: 'round',
24
25
          pointRadius: 2,
26
          pointHitRadius: 10,
27
          pointBorderColor: 'rgba(206, 43, 23, 1)',
28
          pointBackgroundColor: '#fff',
29
          pointBorderWidth: 1,
30
31
          pointHoverRadius: 7,
32
          pointHoverBackgroundColor: 'rgba(206, 43, 23, 1)',
33
          pointHoverBorderColor: '#fff',
34
          pointHoverBorderWidth: 3
35
        }
36
      ]
37
    },
38
    options: {
39
      animation: {
40
        duration: 0
41
      },
42
      legend: {
43
        display: false
44
      },
45
      tooltips: {
46
        cornerRadius: 3
47
      },
48
      scales: {
49
        yAxes: [{
50
          ticks: {
51
            beginAtZero:true
52
          },
53
          gridLines: {
54
            drawBorder: false
55
          }
56
        }],
57
        xAxes: [{
58
          gridLines: {
59
            display: false
60
          }
61
        }]
62
      }
63
    }
64
  });
65
66
});
67